import React from 'react';
import ReactDOM from 'react-dom';
import sty from './Forum.module.css'
import {StarFilled, CommentOutlined} from "@ant-design/icons"
import {Link} from 'react-router-dom';

class PostThumbnail extends React.Component {
    constructor(props) {
        console.log("Post thumbnail initializing!");
        super(props);
        this.state = {
            info: props.info
        };
        // this.state = {
        //     info: {
        //         userID: 12,
        //         avatarURL: "https://img2.baidu.com/it/u=1678948314,1083480950&fm=26&fmt=auto&gp=0.jpg",
        //         userName: '胡卫',
        //         postID: 123,
        //         title: '胡卫的洗澡私密照首曝！',
        //         time: '2021-12-23',
        //         commentsNum: 12,
        //         collectionNum: 23,
        //     }
        // };
    }

    render() {
        return (
            <div className={sty.ListIdem}>
                {/*<a href = {"/user/" + this.state.info['user_id']}>
                    <img src = {this.state.info['avatar']} alt="图片加载失败" className={sty.Avatar}></img>
                </a>*/}
                <Link to={'/TopicInfo/' + this.state.info['id']}>
                    <img src={this.state.info['avatar']} alt="图片加载失败" className={sty.Avatar}></img>
                    <h2 className={sty.Title}>
                        {this.state.info['title']}
                    </h2>
                </Link>
                <div className="帖子其他信息">
                    <span className={sty.Nickname}>{this.state.info['username']}</span>
                    <span className={sty.Time}>{this.state.info['createDatetime']}</span>
                    <span className={sty.Icons}>
                        {/*<StarFilled style={{color: '#eeb63e'}}/>*/}
                        {/*<span className="收藏数" title="收藏数">0</span>*/}
                        <CommentOutlined style={{marginLeft: 10}}/>
                        <span title="回复数" style={{marginLeft: 4}}>{this.state.info['totalComment']}</span>
                    </span>
                </div>
            </div>
        );
    }
}

export default PostThumbnail;